<?php

namespace App\Models\common;

use DateTimeInterface;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

/**
 * 组件实例列表
 */
class SysCom extends Model
{
    use HasFactory;

    protected $table = 'admin_sys_com';

    /**
     * The attributes that are mass assignable.
     *
     * @var array<int, string>
     */
    protected $fillable = [
        'id',
        'code',
        'parent_code',
        'title',
        'type',
        'tables',
        'pri_field',
        'body',
        'desc',
    ];

    /**
     * 为 array / JSON 序列化准备日期格式
     */
    protected function serializeDate(DateTimeInterface $date): string
    {
        return $date->format('Y-m-d H:i:s');
    }
}
